#! user/bin/python
# -*- coding: utf-8 -*-

"""
Created on 2021/8/23 19:11

@File: 行缓冲_socket-unbuff-server.py
@Author: LT
@Description: Use of this module
"""
from socket import *

HOST = ''
PORT = 50007

sock = socket(AF_INET, SOCK_STREAM)
sock.bind((HOST, PORT))
sock.listen(5)
print("server accepting...")
conn, ip_address = sock.accept()                    # 这一步，直到客户端连接进来之前会一直阻塞

for i in range(3):
    print("server receiving...")
    msg = conn.recv(1024)                           # 这一步，直到收到数据之前会一直阻塞
    print(f"server received {msg}")                                      # 会立即收到所有的打印行，除非刷

